package com.tanhua.server.controller;

import com.tanhua.model.vo.UserInfoVo;
import com.tanhua.server.service.UserInfoService;
import com.tanhua.server.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.Map;

/**
 * 用户注册-完善个人（保存用户信息、上传头像）
 */
@RestController
@RequestMapping("/user")
public class UserController {


    @Autowired
    private UserInfoService userInfoService;

    /**
     * 第二步：用户注册：保存用户信息
     */
    @RequestMapping(value = "/loginReginfo",method = RequestMethod.POST)
    public ResponseEntity loginReginfo(@RequestBody UserInfoVo userInfoVo){
        userInfoService.loginReginfo(userInfoVo);
        return ResponseEntity.ok(null);
    }


    /**
     * 第三步：用户注册：上传头像
     */
    @RequestMapping(value = "/loginReginfo/head",method = RequestMethod.POST)
    public ResponseEntity loginHeadReginfo(MultipartFile headPhoto){
        userInfoService.loginHeadReginfo(headPhoto);
        return ResponseEntity.ok(null);
    }


}
